import {request} from "@/utils/request";
import type {BannerItem, DailySuggestItem, GuessAnimalItem} from "@/types/home";
import type {TheBestAnimalItem} from "@/types/hot";
import type {PageResult} from "@/types/PageResult";
import type {DailyImageItem} from "@/types/animals";

/**
 * 获取首页轮播图数据
 */
export const getHomeBannerApi = () => {
    return request<BannerItem[]>({
        method: 'GET',
        url: '/page/home/banner'
    })
}

/**
 * 获取首页世界之最动物数据列表
 */
export const getTheBestListApi = (page: number, pageSize: number) => {
    return request<PageResult<TheBestAnimalItem[]>>({
        method: 'GET',
        url: '/page/best',
        data: {
            page,
            pageSize
        }
    })
}

/**
 * 获取首页猜你喜欢动物数据列表
 */
export const getGuessLikeListApi = (page: number, pageSize: number, uploaderId?: number, tag?: string, title?: string, category?: string) => {
    return request<PageResult<GuessAnimalItem[]>>({
        method: 'GET',
        url: '/AW/guessLike',
        data: {
            page,
            pageSize
        }
    })
}


// new 获取首页每日推荐

export const getDailySuggestListApi = (page: number, pageSize: number, date?: string) => {
    return request<PageResult<DailySuggestItem[]>>({
        method: 'GET',
        url: '/AW/daily',
        data: {
            page,
            pageSize,
            date
        }
    })
}

/**
 * 获取首页每日推荐图片数据列表
 * @param page
 * @param pageSize
 * @param date 推荐日期截至
 */
export const getDailyImgListApi = (page: number, pageSize: number, date?: string) => {
    return request<PageResult<DailyImageItem[]>>({
        method: 'GET',
        url: '/AW/daily/img',
        data: {
            page,
            pageSize,
            date
        }
    })
}
/**
 * 根据用户上传的数据获取动物的识别信息
 * @param base64Image
 */
export const getInfoByPhotoApi = (base64Image: string) => {
    return request<PageResult<GuessAnimalItem[]>>({
        method: 'POST',
        url: '/AW/photo',
        data: {
            base64Image
        }
    })
}